package com.web.service.impl;

import com.web.dao.UserDAO;
import com.web.dao.impl.UserDAOimpl;
import com.web.entity.User;
import com.web.service.UserService;

//用户业务逻辑实现
public class UserServiceimpl implements UserService {
    //调用DAO对象
    private UserDAO userDAO = new UserDAOimpl();

    @Override
        public User login(String username, String password) {
            //调用DAO对象
            User user = userDAO.selectByUsername(username);
            if (user != null) {
                if (password.equals(user.getPassword())) {
                    return user;
                }
            }
        return null;
    }

    @Override
    public void updateUser(User user) {
        userDAO.updateUser(user);
    }
}
